modified: nfig1.py
[GalaxyCodeBases.git] / etc / whichpm / test / Finds multiple modules
blobd6f54deab23382c976c27d35002748b310f85ee4
1 #!/usr/bin/env bash
3 # ---
4 # IMPORTANT: Use the following statement at the TOP OF EVERY TEST SCRIPT
5 # to ensure that this package's 'bin/' subfolder is added to the path so that
6 # this package's CLIs can be invoked by their mere filename in the rest
7 # of the script.
8 # ---
9 PATH=${PWD%%/test*}/bin:$PATH
11 # Helper function for error reporting.
12 die() { (( $# > 0 )) && echo "ERROR: $*" >&2; exit 1; }
14 # Invoke with 2 (core) modules.
15 out=$(whichpm File::Find File::Spec) || die
17 # Convert output lines into an array.
18 IFS=$'\n' read -r -d '' -a lines <<<"$out"
20 # Make sure the corresponding paths are there.
21 pathFragments=( '/File/Find.pm' '/File/Spec.pm' )
22 for (( i = 0; i < 2; i++ )); do
23 [[ "${lines[i]}" =~ "${pathFragments[i]}"$ ]] || die "Expected '${pathFragments[i]}' in output."
24 done
26 exit 0